package com.ytktt.study.week9.task3.rpcfx.lb;

import java.util.List;
import java.util.Random;

/**
 * 基于随机的负载均衡算法
 *
 * @author ytk
 */
public class RandomLoadBalancer implements LoadBalancer {

    @Override
    public String select(List<String> urls) {
        int size = urls.size();
        Random random = new Random(System.currentTimeMillis());
        return urls.get(random.nextInt(size));
    }
}
